<?php
//================ FORMS ===================
$MDCL = 'RD';
$MDOR = 'ED';

if (isset($_GET['CID'])) {
    $OBJCTCL = $_GET['CID'];
} elseif (isset($_POST['OBJCTCL'])) {
    $OBJCTCL = $_POST['OBJCTCL'];
}
$CLST = 0;

if (!isset($OBJCTCL)) {
    $MDCL = 'ED';
    $VWCLDT = 1;
    $Cliente[0] = 1;
    $OBJCTCL = 0;
    $_POST['MDCLDT'] = 'True';
    $CLVARS = "DESCRIBE Clientes";
    $CLVARS = $GLOBALS['MYT']->db_array($CLVARS);
    for ($v = 1; $v <= $CLVARS[0]; $v++) {
        $CLVAR = $CLVARS[$v]['Field'];
        $Cliente[1][$CLVAR] = '';
    }
    $Cliente[1]['CliProfile'] = 1;
    $Cliente[1]['CliClass'] = 1;
    $Cliente[1]['CliOffice'] = $_SESSION[$SESSCD];
    $Cliente[1]['CliFechaNacimiento'] = '1970-01-01';
    $Cliente[1]['CliNacionalidad'] = $__sys['Country'];
    $Cliente[1]['ClPais'] = $__sys['Country'];
} else {
    $Cliente = $GLOBALS['MYT']->db_array("SELECT *, DATE(CliFechaNacimiento) AS CliFechaNacimiento FROM Clientes WHERE CliNumero = {$OBJCTCL}");
}
if ((!isset($_POST['MDCLDT']) || ($_POST['MDCLDT'] == 'True')) && $OBJCTCL > 0) {
    $_POST['MDCLDT'] = 'False';
} else {
    $_POST['MDCLDT'] = 'True';
}

for ($cl = 1; $cl <= $Cliente[0]; $cl++) {
    if ($_POST['MDCLDT'] == 'True' && $Cliente[$cl]['CliOffice'] == $_SESSION[$SESSCD]) {
        $MDCL = 'ED';
    }
    //=====================Client Form=========================
    form_pr('ClientProperties', '', '', 'post');
    // ============= OBJECT & MAPS:CL ======================
    mn_field('hidden', 'ED', 'OBJCTCL', $OBJCTCL, '', '', 'False', '');
    mn_field('hidden', 'ED', 'CliMap', $Cliente[$cl]['CliMap'], '', '', 'False', '');
?>
    <div class="Line">
        <table width="100%" cellpadding="2" cellspacing="1">
            <tr bgcolor="#688F97">
                <td align="left">
                    <table width="100%" border="0" cellspacing="0" cellpadding="1">
                        <tr>
                            <td width="25%"><span style="font-size: 10px;font-weight: bold;color: #FFFFFF;">EXTRACTO DE CLIENTE</span></td>
                            <td>&nbsp;
                            </td>
                        </tr>
                    </table>	</td>
            </tr>
        </table>

        <table width="100%" cellpadding="0" cellspacing="6" bgcolor="#BBCDD0">
            <tr>
                <td NOWRAP>Chave
            <?php mn_field('password', 'ED', 'OriKey', '', '', '', '', ''); ?></td>
            <?php /*
              <td NOWRAP>Periodo do Extracto: <?php mn_field('radio','ED','qrType','1','','','','" checked onclick="
              if (document.ClientProperties.qrType[0].checked==true) {
              document.ClientProperties.qrOther.disabled=true;
              document.ClientProperties.qrTimeStart.disabled=true;
              document.ClientProperties.qrTimeEnd.disabled=true;
              }'); ?>Completo</td>
              <td NOWRAP><?php mn_field('radio','ED','qrType','2','','','','" onclick="
              if (document.ClientProperties.qrType[1].checked==true) {
              document.ClientProperties.qrOther.disabled=false;
              document.ClientProperties.qrTimeStart.disabled=true;
              document.ClientProperties.qrTimeEnd.disabled=true
              };');?></td>
              <td NOWRAP><?php mn_field('hselect','ED','qrOther',1,"Trimestre;Semestre;Ano#1;2;3",'','','" disabled style="'); ?></td>
              <td NOWRAP><?php mn_field('radio','ED','qrType','3','','','','" onclick="
              if (document.ClientProperties.qrType[2].checked==true) {
              document.ClientProperties.qrOther.disabled=true;
              document.ClientProperties.qrTimeStart.disabled=false;
              document.ClientProperties.qrTimeEnd.disabled=false;
              }'); ?>
              de:
              <?php mn_field('date','ED','qrTimeStart',date("Y-m-01"),'ClientProperties','10','','" disabled style="');
              echo ' a ';
              mn_field('date','ED','qrTimeEnd','','ClientProperties','10','','" disabled style="'); ?></td>
             */ ?>
            <td NOWRAP>Tipo de Consulta </td>
            <td NOWRAP><?php
            $Qur = "Resumo;Detalhado#02;01";
            mn_field('hselect', 'ED', 'QrType', 02, $Qur, '', '', '');
            ?></td>
            <td NOWRAP><?php mn_field('button', 'ED', 'Qr_Cl', 'Consultar', '8', '7', '', '" onclick="
					document.ClientProperties.action=\'_response/call.php?get=Operative/client_balance2\';
					subform(\'ClientProperties\',\'Ck_Authz\');'); ?></td>
        </tr>
        <tr>
            <td colspan="7"><div id="Ck_Authz"></div></td>
        </tr>
    </table>
</div>
</form>
<?php } ?>